package swing;


import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

public class Test {
	public static void main(String args[]) {
		JFrame frame = new JFrame("challenge color");
		frame.setBackground(Color.blue);
		frame.setSize(600, 530);
		frame.setLocation(100, 50);
		frame.setLayout(null);
		JButton button = new JButton("gray");
		button.setBounds(50, 450, 60, 30);
		JButton button2 = new JButton("blue");
		button2.setBounds(250, 450, 60, 30);
		JButton button3 = new JButton("red");
		button3.setBounds(450, 450, 60, 30);
		button.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				frame.setBackground(Color.BLACK);
			}
		});

		frame.add(button);
		frame.add(button2);
		frame.add(button3);
		frame.setVisible(true);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
}